


%let msa1='Atlanta';
%let msa2='Boston';
%let msa3='Cincinnati';
%let msa4='Dallas';
%let msa5='Denver';
%let msa6='Detroit';
%let msa7='Houston';
%let msa8='Kansas City';
%let msa9='Minneapolis';
%let msa10='New York';
%let msa11='Phoenix';
%let msa12='Portland';
%let msa13='San Diego';
%let msa14='San Francisco';
%let msa15='Seattle';
%let msa16='Tampa';
%let msa17='Washington';

%let msa18='Los Angeles';
%let msa19='Miami';


data all_msa;
set _null_;
length msa $30;
run;

%macro sum2;

%do i=18 %to 19;


data temp1;
set temp;
if msa_name3=&&msa&i;
run;


proc sql;

create table leases_&i as
select &&msa&i as msa, count(*) as total_leases from temp1;


create table temp2 as
select distinct unit_id from temp1;

create table units_&i as
select &&msa&i as msa, count(*) as total_units from temp2;


create table temp3 as
select distinct property_id from temp1;

create table props_&i as
select &&msa&i as msa, count(*) as total_props from temp3;

data all&i;
merge leases_&i units_&i props_&i;
by msa;
run;

data all_msa;
set all_msa all&i;
run;

%end;
%mend;


%sum2;



